package com.eclink.iot.rfidclient.domain.dto;

import lombok.Data;

@Data
public class ResultDTO {

    private int code = 200;

    private String msg;

    private Object data;

    public static ResultDTO success() {
        return success(null);
    }

    public static ResultDTO success(Object data) {
        ResultDTO resultDTO = new ResultDTO();
        resultDTO.setCode(200);
        resultDTO.setMsg("success");
        resultDTO.setData(data);
        return resultDTO;
    }

    public static ResultDTO fail() {
        return success("fail");
    }

    public static ResultDTO fail(String msg) {
        ResultDTO resultDTO = new ResultDTO();
        resultDTO.setCode(500);
        resultDTO.setMsg(msg);
        return resultDTO;
    }

}
